-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Limited nonzero coercion #143629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Limited nonzero coercion #143629
Conversation
@bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Limited nonzero coercion coercing `NonZero<T>` to `T` if all the types are available at the cast site. This is fairly limited, as (as the tests show), this does not allow "reborrowing" `&NonZero<T>` as `&T`. It also fails quickly if the types aren't fully clear at the coercion site, but only resolved later. Also cannot aid in trait selection or similar, even if there is clearly only one option. Related: * #143594 * rust-lang/rfcs#3786 cc `@traviscross`
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (4a4dd8e): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -4.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.1%, secondary -4.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 467.351s -> 465.395s (-0.42%) |
coercing
NonZero<T>
toT
if all the types are available at the cast site.This is fairly limited, as (as the tests show), this does not allow "reborrowing"
&NonZero<T>
as&T
. It also fails quickly if the types aren't fully clear at the coercion site, but only resolved later.Also cannot aid in trait selection or similar, even if there is clearly only one option.
Related:
NonZero
with literals #143594cc @traviscross